package com.hyc.myvideo.ui.activity.my;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;

import com.flyco.tablayout.SlidingTabLayout;
import com.hyc.myvideo.R;
import com.hyc.myvideo.ui.activity.my.fragment.statistics.StatisticsCourseFragment;
import com.hyc.myvideo.ui.activity.my.fragment.statistics.StatisticsMemberFragment;
import com.hyc.myvideo.ui.base.BaseFActivity;
import com.hyc.myvideo.ui.base.BaseFragment;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * 讲师佣金统计
 * @author gyb
 * @version 1.0
 * @created 2017/07/26
 */
public class StatisticsActivity extends BaseFActivity {
    @BindView(R.id.fragment_column_tabLayout) SlidingTabLayout mTable;
    @BindView(R.id.fragment_column_viewpager)ViewPager mPager;
    private final String[] mTitles = {"我的会员", "我的提成"};
    private List<BaseFragment> fragments = new ArrayList<>();
    MyPagerAdapter mAdapter;
    @Override
    public int getContentViewId(){
        return R.layout.activity_common_course;
    }
    @Override
    protected void initView() {
        setLeftBtnClick(true, getIntent().getStringExtra("title"));
        fragments.add(new StatisticsMemberFragment());
        fragments.add(new StatisticsCourseFragment());
        mAdapter=new MyPagerAdapter(getSupportFragmentManager());
        mPager.setAdapter(mAdapter);
        mTable.setViewPager(mPager);
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void oNext(String resulte, String method) {

    }

    @Override
    protected void oError() {

    }

    private class MyPagerAdapter extends FragmentPagerAdapter {
        public MyPagerAdapter(FragmentManager fm) {
            super(fm);
        }
        @Override
        public Fragment getItem(int position) {
            return fragments.get(position);
        }
        @Override
        public int getCount() {
            return mTitles.length;
        }
        @Override
        public CharSequence getPageTitle(int position) {
            return mTitles[position];
        }
    }
}
